module.exports = function ($scope, $state, $resource,$modal, toaster) {
    
    $scope.load = function () {
          $resource('/api/as/csc/audititem/list', {}, {}).save({},function (res) {
            if (res.errcode !== 0) {
              toaster.error({title: '', body: '查询项目列表失败'});
              return;
            }
            $scope.list = [];
            var typenameMap = {};
            res.data.forEach(element => {
                var index = typenameMap[element.ORG_ID];
                if(index){
                  $scope.list[index-1].list.push(element);
                } else {
                  $scope.list.push({'name': element.type_name, 'org_id': element.ORG_ID, 'list': [element], 'open': true});
                  typenameMap[element.ORG_ID] = $scope.list.length;
                }
            });
          });
    };
    $scope.load();
    
    $scope.upload = function (obj){
      var modalInstance = $modal.open({
        template: require('../views/userInfo.html'),
        controller: 'userInfo',
        size: 'lg',
        resolve: {
          obj: function(){
            return obj;
          }
        }
      });
      modalInstance.result.then(function(showResult){	
        
      });
    }

      
    
  };


